package com.gcd.gym.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gcd.gym.mapper.CoachMapper;
import com.gcd.gym.model.Coach;
import com.gcd.gym.service.CoachService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CoachServiceImpl implements CoachService {
    private CoachMapper coachMapper;

    @Autowired
    public void setCoachMapper(CoachMapper coachMapper) {
        this.coachMapper = coachMapper;
    }

    @Override
    public Page<Coach> findAllCoach(Page<Coach> page, Coach coach) {
        return coachMapper.findAllCoach(page,coach);
    }

    @Override
    public int deleteCoachById(List<Integer> ids) {
        return coachMapper.deleteByIds(ids);
    }

    @Override
    public boolean addCoach(Coach coach) {
        return coachMapper.insert(coach)==1;
    }

    @Override
    public boolean updateCoach(Coach coach) {
        return coachMapper.updateById(coach)==1;
    }
}
